<!-- Copyright (c) 2008 by 1eEurope (Switzerland) AG, Thalwil -->

<%@ Page Language="C#" Debug="true" Inherits="System.Web.UI.Page" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="By1eEurope.BKS.Controls" %>
<%@ Register TagPrefix="SharePointControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="BKSControls" Namespace="By1eEurope.BKS.Controls" Assembly="By1eEurope.BKS.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=10f79a810554359d" %>

<html>
<head runat="server">
    <title><BKSControls:LanguageText id="LongDesc_Title" websiteurl="/" listtitle="LanguageText" columnname="Title"
            columnvaluetrue="LongDesc.Title" langcolumnnames="de-DE,de-CH,fr-CH,it-CH,en-US"
            langnames="de-DE,de-CH,fr-CH,it-CH,en-US" runat="server" /></title>
    <meta http-equiv="content-type" content="text/html" charset="utf-8">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="pragma" content="no-cache">
</head>
<body>

    <script language="CS" runat="server">
        private string message;
        protected string Message
        {
            get { return this.message; }
        }

        private bool hasErrors;
        protected bool HasErrors
        {
            get { return this.hasErrors; }
        }

        protected override void OnLoad(EventArgs e)
        {
            try
            {
                string imageUrl = Request.QueryString["ImageUrl"];
                if (imageUrl.StartsWith("http"))
                {
                    imageUrl = imageUrl.Substring(imageUrl.IndexOf("//") + 2);
                }

                //int firstSlash = imageUrl.IndexOf('/');
                //string server = imageUrl.Substring(0, firstSlash);
                //string image = imageUrl.Substring(firstSlash);

                string val;
                if (SiteUtil.TryGetValue(imageUrl, "LongDesc", out val))
                {
                    if (string.IsNullOrEmpty(val))
                    {
                        hasErrors = true;
                    }
                    else
                    {
                        message = val;
                    }
                }
            }
            catch (Exception ex)
            {
                hasErrors = true;
            }
        }
    </script>

    <p>
        <% if (!HasErrors)
              {
                  Response.Write(Message);
              }
              else
              { %>
        <BKSControls:languagetext id="LongDesc_Error" websiteurl="/" listtitle="LanguageText" columnname="Title"
            columnvaluetrue="LongDesc.Error" langcolumnnames="de-DE,de-CH,fr-CH,it-CH,en-US"
            langnames="de-DE,de-CH,fr-CH,it-CH,en-US" runat="server" />
        <% } %>
    </p>
</body>
</html>
